package servlet.isbn_to_inf;

public class RobotApi {
    private static final String ROBOT_API_HOST = "http://openapi.tuling123.com/openapi/api/v2";
    private String key;
    private String isbn;

    public RobotApi(String key, String isbn) {
        super();
        this.key = key;
        this.isbn = isbn;
    }
private String buildParams(String key,String isbn) {
    String a = "https://api.jike.xyz/situ/book/isbn/";
    String b = "?apikey=";
//    String string ="https://api.jike.xyz/situ/book/isbn/9787020024759?apikey=12469.fcd2ac4e9b8099d51e8db251737d84b8.ed524086f8e7ec7c9d0aaa5c9c3dd350";//样例
    String string =a+isbn+b+key;
    return string;

}
    public String getRobotResult(String key,String isbn) {

        //return HttpPost.doPost(ROBOT_API_HOST, buildParams(Word));
        String test = buildParams(key,isbn);//打包url请求地址
        return HttpUtils.sendGet(test,"");//get请求
        //token是用来生成header的，但是目前这个不需要header输入更多信息，留空。
    }
}
